<template>
  <div class="product-cover">
    <a-video v-if="src && src.indexOf('.mp4') !== -1" class="cover" :poster="poster" :src="src" :controls="true" />
    <a-image v-else class="cover" :src="src" />
  </div>
</template>

<script>
export default {
  name: 'ProductCover',
  components: {},
  props: {
    src: {
      type: String,
      default: undefined,
      require: false,
    },
    poster: {
      type: String,
      default: undefined,
      require: false,
    },
  },
  data() {
    return {}
  },
  mounted() {},
  methods: {},
}
</script>

<style scoped lang="less">
.product-cover {
  margin-left: 10px;
  width: 400px;
  height: 400px;
  object-fit: cover;
  overflow: hidden;
}

.cover {
  margin-top: 10px;
  width: 400px;
  height: 400px;
  object-fit: cover;
}
</style>

